const router = require('koa-router')();
const noteService = require('../service/noteService.js');
const result = require("../com/result.js")
const log=require('../com/logConfig.js')
router.prefix('/note')

/**
 * 塞入短信记录
 */
router.post('/save', async (ctx, next) => {
    try{
        let result = noteService.noteSave(ctx, next);
        return await result;
    }catch(e){
        log.error('塞入短信记录异常',e);
        ctx.body = result.go(result.code.CODE_500);
        return;
    }
});


/**
 * 查询短信记录
 */
router.post('/find', async (ctx, next) => {
    try{
        let result = noteService.noteFind(ctx, next);
        return await result;
    }catch(e){
        log.error('查询短信记录异常',e);
        ctx.body = result.go(result.code.CODE_500);
        return;
    }
});

// router.post('/test',async (ctx,next)=>{
//     // redis.del("qqqqqqq",()=>{
//     //     console.log('dsfasdf')
//     //     ctx.body = result.go(result.code.CODE_500);

//     // });
// });

module.exports = router
